//
//  UIView+Extion.swift
//  VIZ微博
//
//  Created by 位立志 on 16/4/7.
//  Copyright © 2016年 位立志. All rights reserved.
//

import UIKit

extension UIView {
    
    //圆角
    @IBInspectable var cornerRadius :CGFloat{
        
        get{
            return layer.cornerRadius
        }
        set{
            layer.cornerRadius = newValue
            
            //设置裁剪角
            if newValue < 0 {
                layer.masksToBounds = false
            }else{
                layer.masksToBounds = true
            }
            
        }
    }
    
    //边框宽度
    @IBInspectable var borderWidth:CGFloat{
        
        get{
            return layer.borderWidth
        }
        set{
            layer.borderWidth = newValue
        }
    }
    
    //边颜色
    @IBInspectable var borderColor:UIColor{
        
        get{
            return UIColor(CGColor: self.layer.borderColor!)
        }
        set{
            layer.borderColor = newValue.CGColor
        }
        
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}









